package com.tz.actions;

import com.tz.service.HelloService;
import com.tz.service.HelloServiceImpl;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;

/**
 * HelloAction
 */
@Namespace(value="/")
//对应到物理结果页面
@Result(name = "success",
        location = "/hello.jsp") // 斜杠表示web根目录
public class HelloAction {

    private HelloService helloService = new HelloServiceImpl();

    @Action("hello")
    //方法必须是:public String 无参
    public String execute(){
        String str = helloService.sayHi();
        System.out.println("str:"+str);
        return "success"; //逻辑结果名
    }

}
